<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>递归和堆栈</title>
  </head>
  <body>
    <a href="https://zh.javascript.info/recursion">递归和堆栈</a>
    <script>
      function pod(x, n) {
        if (n == 1) {
          // 等于1 终止函数调用
          console.log(n);
          return x;
        } else {
          console.log(n); // 4,3,2,1
          return x * pod(x, n - 1);
        }
      }
      console.log(pod(2, 4));
    </script>
  </body>
</html>
